
/**
 * Copyright 2014-2020  the original author or authors.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package com.upb.webserver.company;

import com.upb.webserver.common.pojo.base.BaseResponse;
import com.upb.webserver.common.pojo.company.RspCompanyVO;
import com.upb.webserver.common.returncode.ConstantCode;
import com.upb.webserver.common.tools.JsonUtils;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Log4j2
@RestController
@RequestMapping(value = "company")
public class CompanyController {

    @Autowired
    private CompanyService companyService;

    /**
     * @param companyId
     * @return
     */
    @GetMapping(value = "/{companyId}/detail")
    public BaseResponse queryCompanyDetail(@PathVariable("companyId") Integer companyId) {
        log.info("start exec method [queryOrgDetail]. companyId:{}", companyId);
        RspCompanyVO companyVO = companyService.queryCompanyDetail(companyId);
        BaseResponse baseResponse = new BaseResponse(ConstantCode.SUCCESS, companyVO);
        log.info("success exec method [queryOrgDetail]. result:{}", JsonUtils.objToString(baseResponse));
        return baseResponse;
    }


}
